/*
 * VisualMidlet.java
 *
 * Created on May 3, 2007, 5:24 PM
 */

package info;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

/**
 *
 * @author root
 */
public class VisualMidlet extends MIDlet implements CommandListener {
    
    /** Creates a new instance of VisualMidlet */
    public VisualMidlet() {
        initialize();
    }
    
    private Command screenCommand1;//GEN-BEGIN:MVDFields
    private Command screenCommand2;
    private Form form1;
    private Command cancelCommand1;
    private Spacer spacer1;
    private Command exitCommand1;
    private Command screenCommand3;
    private Command okCommand1;
    private Command cancelCommand2;
    private TextField textField1;
    private Command backCommand1;
    private Command screenCommand4;
    private Font font1;
    private TextField textField2;//GEN-END:MVDFields
    
//GEN-LINE:MVDMethods

    /** Called by the system to indicate that a command has been invoked on a particular displayable.//GEN-BEGIN:MVDCABegin
     * @param command the Command that ws invoked
     * @param displayable the Displayable on which the command was invoked
     */
    public void commandAction(Command command, Displayable displayable) {//GEN-END:MVDCABegin
    // Insert global pre-action code here
        if (displayable == form1) {//GEN-BEGIN:MVDCABody
            if (command == cancelCommand2) {//GEN-END:MVDCABody
                // Insert pre-action code here
                // Do nothing//GEN-LINE:MVDCAAction30
                // Insert post-action code here
            } else if (command == okCommand1) {//GEN-LINE:MVDCACase30
                // Insert pre-action code here
                getDisplay().setCurrent(get_form1());//GEN-LINE:MVDCAAction28
                // Insert post-action code here
            } else if (command == screenCommand3) {//GEN-LINE:MVDCACase28
                // Insert pre-action code here
                // Do nothing//GEN-LINE:MVDCAAction26
                // Insert post-action code here
            }//GEN-BEGIN:MVDCACase26
        }//GEN-END:MVDCACase26
    // Insert global post-action code here
}//GEN-LINE:MVDCAEnd

    /** This method initializes UI of the application.//GEN-BEGIN:MVDInitBegin
     */
    private void initialize() {//GEN-END:MVDInitBegin
        // Insert pre-init code here
        getDisplay().setCurrent(get_form1());//GEN-LINE:MVDInitInit
        // Insert post-init code here
    }//GEN-LINE:MVDInitEnd
    
    /**
     * This method should return an instance of the display.
     */
    public Display getDisplay() {//GEN-FIRST:MVDGetDisplay
        return Display.getDisplay(this);
    }//GEN-LAST:MVDGetDisplay
    
    /**
     * This method should exit the midlet.
     */
    public void exitMIDlet() {//GEN-FIRST:MVDExitMidlet
        getDisplay().setCurrent(null);
        destroyApp(true);
        notifyDestroyed();
    }//GEN-LAST:MVDExitMidlet
    /** This method returns instance for screenCommand1 component and should be called instead of accessing screenCommand1 field directly.//GEN-BEGIN:MVDGetBegin19
     * @return Instance for screenCommand1 component
     */
    public Command get_screenCommand1() {
        if (screenCommand1 == null) {//GEN-END:MVDGetBegin19
            // Insert pre-init code here
            screenCommand1 = new Command("Screen", Command.SCREEN, 1);//GEN-LINE:MVDGetInit19
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd19
        return screenCommand1;
    }//GEN-END:MVDGetEnd19

    /** This method returns instance for screenCommand2 component and should be called instead of accessing screenCommand2 field directly.//GEN-BEGIN:MVDGetBegin20
     * @return Instance for screenCommand2 component
     */
    public Command get_screenCommand2() {
        if (screenCommand2 == null) {//GEN-END:MVDGetBegin20
            // Insert pre-init code here
            screenCommand2 = new Command("Screen", Command.SCREEN, 1);//GEN-LINE:MVDGetInit20
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd20
        return screenCommand2;
    }//GEN-END:MVDGetEnd20

    /** This method returns instance for form1 component and should be called instead of accessing form1 field directly.//GEN-BEGIN:MVDGetBegin21
     * @return Instance for form1 component
     */
    public Form get_form1() {
        if (form1 == null) {//GEN-END:MVDGetBegin21
            // Insert pre-init code here
            form1 = new Form(null, new Item[] {//GEN-BEGIN:MVDGetInit21
                get_spacer1(),
                get_textField1(),
                get_textField2()
            });
            form1.addCommand(get_screenCommand3());
            form1.addCommand(get_okCommand1());
            form1.addCommand(get_cancelCommand2());
            form1.setCommandListener(this);//GEN-END:MVDGetInit21
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd21
        return form1;
    }//GEN-END:MVDGetEnd21

    /** This method returns instance for cancelCommand1 component and should be called instead of accessing cancelCommand1 field directly.//GEN-BEGIN:MVDGetBegin22
     * @return Instance for cancelCommand1 component
     */
    public Command get_cancelCommand1() {
        if (cancelCommand1 == null) {//GEN-END:MVDGetBegin22
            // Insert pre-init code here
            cancelCommand1 = new Command("Cancel", Command.CANCEL, 1);//GEN-LINE:MVDGetInit22
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd22
        return cancelCommand1;
    }//GEN-END:MVDGetEnd22

    /** This method returns instance for spacer1 component and should be called instead of accessing spacer1 field directly.//GEN-BEGIN:MVDGetBegin23
     * @return Instance for spacer1 component
     */
    public Spacer get_spacer1() {
        if (spacer1 == null) {//GEN-END:MVDGetBegin23
            // Insert pre-init code here
            spacer1 = new Spacer(1000, 1);//GEN-LINE:MVDGetInit23
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd23
        return spacer1;
    }//GEN-END:MVDGetEnd23

    /** This method returns instance for exitCommand1 component and should be called instead of accessing exitCommand1 field directly.//GEN-BEGIN:MVDGetBegin24
     * @return Instance for exitCommand1 component
     */
    public Command get_exitCommand1() {
        if (exitCommand1 == null) {//GEN-END:MVDGetBegin24
            // Insert pre-init code here
            exitCommand1 = new Command("Exit", Command.EXIT, 1);//GEN-LINE:MVDGetInit24
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd24
        return exitCommand1;
    }//GEN-END:MVDGetEnd24

    /** This method returns instance for screenCommand3 component and should be called instead of accessing screenCommand3 field directly.//GEN-BEGIN:MVDGetBegin25
     * @return Instance for screenCommand3 component
     */
    public Command get_screenCommand3() {
        if (screenCommand3 == null) {//GEN-END:MVDGetBegin25
            // Insert pre-init code here
            screenCommand3 = new Command("Screen", Command.SCREEN, 1);//GEN-LINE:MVDGetInit25
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd25
        return screenCommand3;
    }//GEN-END:MVDGetEnd25

    /** This method returns instance for okCommand1 component and should be called instead of accessing okCommand1 field directly.//GEN-BEGIN:MVDGetBegin27
     * @return Instance for okCommand1 component
     */
    public Command get_okCommand1() {
        if (okCommand1 == null) {//GEN-END:MVDGetBegin27
            // Insert pre-init code here
            okCommand1 = new Command("Ok", Command.OK, 1);//GEN-LINE:MVDGetInit27
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd27
        return okCommand1;
    }//GEN-END:MVDGetEnd27

    /** This method returns instance for cancelCommand2 component and should be called instead of accessing cancelCommand2 field directly.//GEN-BEGIN:MVDGetBegin29
     * @return Instance for cancelCommand2 component
     */
    public Command get_cancelCommand2() {
        if (cancelCommand2 == null) {//GEN-END:MVDGetBegin29
            // Insert pre-init code here
            cancelCommand2 = new Command("Cancel", Command.CANCEL, 1);//GEN-LINE:MVDGetInit29
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd29
        return cancelCommand2;
    }//GEN-END:MVDGetEnd29

    /** This method returns instance for textField1 component and should be called instead of accessing textField1 field directly.//GEN-BEGIN:MVDGetBegin31
     * @return Instance for textField1 component
     */
    public TextField get_textField1() {
        if (textField1 == null) {//GEN-END:MVDGetBegin31
            // Insert pre-init code here
            textField1 = new TextField("textField1", null, 120, TextField.PHONENUMBER | TextField.SENSITIVE | TextField.NON_PREDICTIVE);//GEN-BEGIN:MVDGetInit31
            textField1.setLayout(Item.LAYOUT_RIGHT | Item.LAYOUT_BOTTOM | Item.LAYOUT_NEWLINE_AFTER | Item.LAYOUT_VSHRINK | Item.LAYOUT_VEXPAND);//GEN-END:MVDGetInit31
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd31
        return textField1;
    }//GEN-END:MVDGetEnd31
    /** This method returns instance for backCommand1 component and should be called instead of accessing backCommand1 field directly.//GEN-BEGIN:MVDGetBegin33
     * @return Instance for backCommand1 component
     */
    public Command get_backCommand1() {
        if (backCommand1 == null) {//GEN-END:MVDGetBegin33
            // Insert pre-init code here
            backCommand1 = new Command("Back", Command.BACK, 1);//GEN-LINE:MVDGetInit33
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd33
        return backCommand1;
    }//GEN-END:MVDGetEnd33

    /** This method returns instance for screenCommand4 component and should be called instead of accessing screenCommand4 field directly.//GEN-BEGIN:MVDGetBegin35
     * @return Instance for screenCommand4 component
     */
    public Command get_screenCommand4() {
        if (screenCommand4 == null) {//GEN-END:MVDGetBegin35
            // Insert pre-init code here
            screenCommand4 = new Command("Screen", Command.SCREEN, 1);//GEN-LINE:MVDGetInit35
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd35
        return screenCommand4;
    }//GEN-END:MVDGetEnd35

    /** This method returns instance for font1 component and should be called instead of accessing font1 field directly.//GEN-BEGIN:MVDGetBegin37
     * @return Instance for font1 component
     */
    public Font get_font1() {
        if (font1 == null) {//GEN-END:MVDGetBegin37
            // Insert pre-init code here
            font1 = Font.getDefaultFont();//GEN-LINE:MVDGetInit37
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd37
        return font1;
    }//GEN-END:MVDGetEnd37

    /** This method returns instance for textField2 component and should be called instead of accessing textField2 field directly.//GEN-BEGIN:MVDGetBegin38
     * @return Instance for textField2 component
     */
    public TextField get_textField2() {
        if (textField2 == null) {//GEN-END:MVDGetBegin38
            // Insert pre-init code here
            textField2 = new TextField("textField2", "fgf", 120, TextField.EMAILADDR | TextField.SENSITIVE | TextField.NON_PREDICTIVE);//GEN-BEGIN:MVDGetInit38
            textField2.setPreferredSize(100, 200);
            textField2.setLayout(Item.LAYOUT_CENTER | Item.LAYOUT_VCENTER | Item.LAYOUT_NEWLINE_AFTER | Item.LAYOUT_SHRINK | Item.LAYOUT_VEXPAND | Item.LAYOUT_2);
            textField2.setInitialInputMode("gfdf");//GEN-END:MVDGetInit38
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd38
        return textField2;
    }//GEN-END:MVDGetEnd38
     
    public void startApp() {
    }
    
    public void pauseApp() {
    }
    
    public void destroyApp(boolean unconditional) {
    }
    
}
